package com.kady.controller.admin;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: kady
 * \* Date: 2021/3/30
 * \* Time: 10:38
 * \* 千峰JAVA2101班
 * \* Description: 登出
 * \
 */
@WebServlet("/userService/logout")
public class AdminLogOutController extends HttpServlet {
    /**
     * 登出接口,不走BaseServlet
     */

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getSession().removeAttribute("adminUser");
        req.getSession().removeAttribute("password");
        resp.sendRedirect(req.getContextPath() + "/backend/index.jsp");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
